package org.top10.parser;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.top10.collector.Collector;
import org.top10.dealor.ConfReader;
import org.top10.entity.ConfBean;
import org.top10.executor.ParseSource;
import org.top10.util.TOP10Global;


public class SinaTask extends Task {

	private static final int webSiteID = TOP10Global.WEB_SITE_ID_SINA;// 对应网站ID
	private static final String ENCoding = "gb2312";// 对应网站ID;
	private static final SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd");
	public SinaTask() {
		super(webSiteID,ENCoding);
	}
	
	public void loadParser() {
		PARSER.add(new NewsAllParser("国内新闻 ",TOP10Global.TYPE_News, getTodayUrl("http://top.news.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=china&top_time=@@&top_show_num=10&top_order=ASC&chars=gb2312")));
		PARSER.add(new NewsAllParser("国外新闻", TOP10Global.TYPE_News,getTodayUrl("http://top.news.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=world&top_time=@@&top_show_num=10&top_order=ASC&chars=gb2312")));
		PARSER.add(new NewsAllParser("社会新闻",TOP10Global.TYPE_News, getTodayUrl("http://top.news.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=society&top_time=@@&top_show_num=10&top_order=ASC&chars=gb2312")));
		PARSER.add(new NewsAllParser("娱乐",TOP10Global.TYPE_ENT,getTodayUrl("http://top.ent.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=all&top_time=@@&top_show_num=10&top_order=ASC&chars=gb2312")));
		PARSER.add(new NewsAllParser("体育",TOP10Global.TYPE_Sports,getTodayUrl("http://top.sports.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=all&top_time=@@&top_show_num=10&top_order=ASC&chars=gb2312")));
		PARSER.add(new NewsAllParser("财经",TOP10Global.TYPE_Finance,getTodayUrl("http://top.finance.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=all&top_time=@@&top_show_num=10&top_order=ASC&chars=gb2312")));
		
		//PARSER.add(new NewsAllPar一位ser("财经",TOP10Global.TYPE_Finance,getTodayUrl("http://top.finance.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=all&top_time=@@&top_show_num=10&top_order=ASC&chars=gb2312")));
		
		PARSER.add(new SinaBlogDayTopParser("博客","http://top.sports.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=all&top_time=@@&top_show_num=10&top_order=ASC&chars=gb2312"));
		///视频
		PARSER.add(new SinaDayTopParser("日增",getTodayUrl("http://top.video.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=sphhzpx&top_time=@@&top_show_num=10&top_order=DESC&js_var=sphhzpx_1_data&chars=gb2312")));
		PARSER.add(new SinaWeekTopParser("周增",getTodayUrl("http://top.video.sina.com.cn/ws/GetTopDataList.php?top_type=week&top_cat=sphhzpx&top_time=@@&top_show_num=10&top_order=DESC&js_var=sphhzpx_2_data&chars=gb2312")));
		PARSER.add(new SinaMouthTopParser("月增",getTodayUrl("http://top.video.sina.com.cn/ws/GetTopDataList.php?top_type=month&top_cat=sphhzpx&top_time=@@&top_show_num=10&top_order=DESC&js_var=sphhzpx_3_data&chars=gb2312")));
	    //读书
		PARSER.add(new SinaBookParser());
		//论坛
		PARSER.add(new NewsAllParser("论坛",TOP10Global.TYPE_Forum,"http://top.bbs.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=tzzbdj&top_time=today&top_show_num=10&top_order=DESC&js_var=jsondata&chars=gbk"));
	    
	}
	private static String getTodayUrl(String url){
		if(url==null)return null;
		return url.replaceFirst("@@", sdf.format(new Date()));
	}
	public static void main(String args[]) throws Exception {
		
		new SinaEmotionParser().dealText(ENCoding);
	}
}


